﻿<?php 
    session_start();
	include "connect.php";
	
	if (!isset($_SESSION["taikhoan"]))
	{
		header("Location: gv-dangnhap.php");
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Kết Quả Đánh Giá</title>
<style type="text/css">

a	{
		color: #006600;
		text-decoration: none;
	}

a:hover { COLOR:#FF0000;}

.style2 {
	font-size: 18px;
	font-weight: bold;
	color: #FFFFFF;
}
.style3 {font-size: 14px; font-weight: bold; color: #FFFFFF; }
.style4 {
	color: #000099;
	font-weight: bold;
	font-size:20px;
}
.style5 {	color: #FFFFFF;
	font-weight: bold;
	font-size: 30px;
}
.bg {	border-right-color:#0066FF;
		border-bottom-color:#0066FF;
	}

.bg1 {	border-bottom-color:#0066FF;}

.bg2 {	border-top-color:#0066FF;}

.bg3 {	border-left-color:#0066FF;}

.bg4 {	border-right-color:#0066FF;}
.mo	{	color:#0000FF;	}
.style6 {
	
	color: #000099;
}
.style7{
	font-size: 20px;
	font-weight: bold;
}
</style>

<script language="javascript">
	function openUrl(a)
	{
		var win = window.open(a,'Buy ticket',
			'width=' + 1400 + ', height=' + 900 + ', ' +
			'left=' + 0 + ', top=' + 0 + ', ' +
			'location=no, menubar=no, ' +
			'status=no, toolbar=no, scrollbars=yes, resizable=no');
	}
</script>
</head>
<body>
<?php
	  if($_GET["act"] == "in")
	  {
	  	$magv = $_GET["magv"];
	  }
	  else
	  {
	  	$magv=$_SESSION['gv'];
	  }
	  
      $ma_hp=$_REQUEST["ma"];
	  $hknk=$_REQUEST["hk"];
	  $stt=$_REQUEST["nhom"];
	  $tam=mysql_query("select * from `hocki nienkhoa` where ma_hknk='$hknk' ");
	  $t=mysql_fetch_row($tam);
	  $hk=$t[1];$nk=$t[2];
	  $sql=mysql_query("select ten_hp,sotinchi,ten_gv,a.ma_gv,ten_bm,ten_khoa from `lop hoc phan` a, `hoc phan` b, `giang vien` c, `bo mon` d, khoa e where a.ma_hp='$ma_hp' and a.stt_nhom='$stt' and a.ma_hknk='$hknk' and a.ma_gv=c.ma_gv and c.ma_bm=d.ma_bm and d.ma_khoa=e.ma_khoa and a.ma_hp=b.ma_hp and a.ma_gv='$magv'");
	  $r=mysql_fetch_row($sql);
	  $tenhp=$r[0];
	  $stc=$r[1];
	  $tengv=$r[2];
	  $magv=$r[3];
	  $tenbm=$r[4];
	  $tenkhoa=$r[5];
		$s=mysql_query("select sisolop_hp from `lop hoc phan` where ma_hp='$ma_hp' and ma_hknk='$hknk' and stt_nhom='$stt'");
		$s1=mysql_fetch_row($s);
		$ss=$s1[0];
		$dem=0;
		$k=mysql_query("select distinct (ma_sv) from `danh gia` where ma_hp='$ma_hp' and stt_nhom='$stt' and ma_hknk='$hknk'");
		while($k1=mysql_fetch_row($k))
		{
		       $ma=$k1[0];
			   $dem++;
		}
?>
<!-- đầu trang --> 	
<?php
		            $kq=mysql_query("select extract(day from curdate()),extract(month from curdate()),extract(year from curdate()) "); 
					while ($r=mysql_fetch_row($kq))
					{
						$ngay=$r[0];
						$thang=$r[1];
						$nam=$r[2];
					}
		  ?>  
<?php // convert image to dataURL
$img_source = "image/logo.gif"; // image path/name
$img_binary = fread(fopen($img_source, "r"), filesize($img_source));
$img_string = "data:image/gif;base64,".base64_encode($img_binary);
?>

	<div align="right">
	<a href="#" onclick="openUrl('exportPDF.php<?php echo "?type=gvinketqua&magv=".$magv."&ma=".$_REQUEST["ma"]."&nhom=".$_REQUEST["nhom"]."&hk=".$_REQUEST["hk"]."&act=in"; ?>');"/>Mẫu In  <?php echo $ngay; ?>/<?php echo $thang; ?>/<?php echo $nam; ?></a></div>
	
	<tr> <td width="900">
   	  <table width="100%" border="0">
          
          <tr>
		    <td  rowspan="2" width="100" style="border:none"><img src="<?php echo $img_string; ?>" height="70" width="100" /></td>
            <td colspan="2" style="border:none"><div align="left" style="font-size:18px; font-weight:bold" class="style6">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TRƯỜNG ĐẠI HỌC CẦN THƠ</div></td>
            <td colspan="3" style="border:none"><div align="center" style="font-size:18px; font-weight:bold;" class="style6">CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM</div></td>
          </tr>
          
          <tr>
            <td colspan="2" style="border:none"><div align="left" style="font-size:18px; font-weight:bold;" class="style6">Khoa <?php echo $tenkhoa; ?> </div></td>
            <td colspan="3" style="border:none"><div align="center" style="font-size:18px; font-weight:bold" class="style6" >Độc lập - Tự do - Hạnh phúc </div></td>
          </tr>
          
          <tr>
            <td width="100" style="border:none">&nbsp;</td>
			<td width="294" style="border:none" >&nbsp;</td>
			<td width="131" style="border:none" >&nbsp;</td>
            <td width="215" style="border:none">&nbsp;</td>
            <td width="108" class="bg2" style="border:none">&nbsp;</td>
            <td width="218" style="border:none">&nbsp;</td>
          </tr>
                    

          <tr>
            <td height="40" colspan="6"  style="font-size:30px; font-weight:bold; border:none;" class="style6" align="center" valign="bottom">
			     KẾT QUẢ ĐÁNH GIÁ HỌC PHẦN
            </td>
          </tr>
		  
		  <tr>
            <td height="50" colspan="6"  style="font-size:18px; font-weight:bold; border:none" class="style6" align="center" valign="top">
			     Học Kì <?php echo $hk; ?> (<?php echo $nk; ?>)
            </td>
          </tr>
          
         <tr valign="top">
            <td height="20" colspan="6" style="font-size:22px; font-weight:bold; color:#000099; border:none">* Thông tin chung: </td>
        
        </tr>
		  
		 <tr valign="top">
            <td height="15" colspan="6" style="border:none"> </td>
            
        </tr>
		 
         <tr valign="top">
		    
            <td height="30" colspan="3" style="font-size:20px; border:none" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Tên Học Phần: <strong><?php echo $tenhp; ?></strong></td>
            <td colspan="3" style="font-size:20px; border:none" >Mã Số Học Phần: <strong><?php echo $ma_hp; ?></strong> </td>
        </tr>
          
		<tr valign="top">
            <td height="30" colspan="3" style="font-size:20px; border:none"  >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Mã Số Lớp Học Phần: <strong><?php echo $ma_hp ?><?php echo $hknk; ?><?php echo $stt; ?></strong></td>
            <td colspan="3" style="font-size:20px; border:none" >Số Tín Chỉ: <strong><?php echo $stc; ?></strong> </td>
        </tr>
		
		<tr valign="top" >
            <td height="30" colspan="3" style="font-size:20px; border:none" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Họ Và Tên Giảng Viên: <strong><?php echo $tengv; ?></strong></td>
            <td colspan="3" style="font-size:20px; border:none" >Mã Số Cán Bộ: <strong><?php echo $magv; ?></strong> </td>
        </tr>
		
		<tr valign="top">
            <td height="30" colspan="3" style="font-size:20px; border:none" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Bộ Môn: <strong><?php echo $tenbm; ?></strong></td>
            <td colspan="3" style="font-size:20px; border:none" >Khoa/Viện/Đơn Vị: <strong><?php echo $tenkhoa; ?></strong> </td>
        </tr>
		 <tr valign="top">
            <td height="20"  style="font-size:22px; font-weight:bold; color:#000099; border:none" colspan="6">* Kết Quả Đánh Giá: </td>
            
        </tr>
         <tr valign="top">
            <td height="30" colspan="6" style="border:none"> </td>
           
        </tr>
      </table>
    </td> 
	</tr>
	
	<!--than trang -->	
		
    <tr> <td valign="top">
    	
        <table width="1000" align="center" cellspacing="0" border="1" bordercolor="#0066FF" cellpadding="0">
                            
      		<tr align="center" bgcolor="#CCCCCC">
            	<td width="513" height="40" class="bg"><span class="style7">Nội Dung Đánh Giá</span>				</td>
       	  	  	<td width="133" class="bg">
				          <span class="style7">Chưa Hài Lòng</span>				</td>
				<td width="112" class="bg">
				          <span class="style7">Hài Lòng</span>				</td>
				<td width="118" class="bg">
				          <span class="style7">Rất Hài Lòng</span>				</td>
				<td width="112" class="bg1">
				          <span class="style7">Xuất Sắc</span>				</td>
				
       	  	</tr>

		   <?php
		           
					
					    $sql=mysql_query("select a.ma_tc,a.noidung_tc from `tieu chi` a, `tieuchi hocki` b where a.ma_tc=b.ma_tc and b.ma_hknk='$hknk' ");
						
						while($row=mysql_fetch_row($sql))
						{
						   $matc=$row[0];
						   $noidung=$row[1];
						   $sql1=mysql_query("select ma_tc,`muc danh gia`,count(*) from `danh gia` where  stt_nhom='$stt' and ma_hp='$ma_hp' and ma_hknk='$hknk' and ma_tc='$matc' and `muc danh gia`='1' group by `muc danh gia`,ma_tc");
						   $sql2=mysql_query("select ma_tc,`muc danh gia`,count(*) from `danh gia` where  stt_nhom='$stt' and ma_hp='$ma_hp' and ma_hknk='$hknk' and ma_tc='$matc' and `muc danh gia`='2' group by `muc danh gia`,ma_tc");
						   $sql3=mysql_query("select ma_tc,`muc danh gia`,count(*) from `danh gia` where  stt_nhom='$stt' and ma_hp='$ma_hp' and ma_hknk='$hknk' and ma_tc='$matc' and `muc danh gia`='3' group by `muc danh gia`,ma_tc");
						   $sql4=mysql_query("select ma_tc,`muc danh gia`,count(*) from `danh gia` where  stt_nhom='$stt' and ma_hp='$ma_hp' and ma_hknk='$hknk' and ma_tc='$matc' and `muc danh gia`='4' group by `muc danh gia`,ma_tc");
						   if(mysql_num_rows($sql1)==0) $muc1=0;
						   else
						   {
						   $r1=mysql_fetch_row($sql1);
						   $muc1=$r1[2];
						   }
						   if(mysql_num_rows($sql2)==0) $muc2=0;
						   else
						   {
						   $r2=mysql_fetch_row($sql2);
						   $muc2=$r2[2];
						   }
						   if(mysql_num_rows($sql3)==0) $muc3=0;
						   else
						   {
						   $r3=mysql_fetch_row($sql3);
						   $muc3=$r3[2];
						   }
						   if(mysql_num_rows($sql4)==0) $muc4=0;
						   else
						   {
						   $r4=mysql_fetch_row($sql4);
						   $muc4=$r4[2];
						   }
						   ?>
						   <tr>
						       <td class="bg" height="60" style="font-size:20px;">
							         <?php echo "&nbsp;&nbsp; $matc. $noidung"; ?> 
							   </td>
					
							   <td class="bg" align="center">
							        <?php 
										  echo "$muc1 &nbsp;&nbsp; SV";
										  
									?>
							   </td>
							   <td class="bg" align="center">
							        <?php
									       
										  echo "$muc2 &nbsp;&nbsp; SV";
									?>
							   </td>
							   <td class="bg" align="center">
							         <?php
									      
										   echo "$muc3 &nbsp;&nbsp; SV";
									 ?>
							   </td>
							   <td class="bg1" align="center">
							          <?php
									       echo "$muc4 &nbsp;&nbsp; SV";
										   
									?>
							   </td> 
							     
                           </tr>
						   <?php
						      
						}//while
						 
					 
		   ?>
		  
		   <tr> <td height="50" colspan="5">
				<table width="100%"> <tr >
					<td width="98%" ><label><div align="right">
					             <table cellpadding="0" cellspacing="0" border="0"  height="40"  >
								       <tr >
									         <td  class="style6" align="right" style="font-size:20px; font-weight:bold">
											 Sỉ Số Lớp Học Phần: <?php echo $ss; ?><br />
											 Số Lượng Sinh Viên Tham Gia Đánh Giá: <?php echo $dem; ?>
											 
											 </td>
									   </tr>
								 </table>
					                 </div></label></td>
					<td width="2%"></td>
				</tr> </table>
                </td> 
	      </tr>
		  </table>
		  </td>
		  </tr>
<!-- cuoi trang -->
       <tr><td height="30">&nbsp;</td> </tr>		  
	   <tr> 
				 <td width="900">
						  <table width="100%" border="0" >
								  <tr valign="top" bordercolor="#FFFFFF">
									  <td height="20" colspan="6" style="font-size:22px; font-weight:bold; color:#000099;">* Ý Kiến Khác: </td>
							
								 </tr>
								 <tr valign="top" bordercolor="#FFFFFF">
									 <td height="10"  > </td>
									 <td colspan="5" ></td>
								 </tr>
								 
								 <tr valign="top" bordercolor="#FFFFFF">
									  <td height="20" colspan="6" style="font-size:20px; font-weight:bold;" align="left"> 
												<?php
															$t=mysql_query("select ghi_chu from hoc where stt_nhom='$stt' and ma_hknk='$hknk' and ma_hp='$ma_hp'"); 
															while ($t1=mysql_fetch_row($t))
															{	$t2=$t1[0];
																if($t2=="") echo "";
																else
																		echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $t2<br/>";
															}
																
												?>
									  </td>
							
								 </tr>
								 
								 <tr valign="top" bordercolor="#FFFFFF">
									 <td height="30"  >&nbsp; </td>
									 <td colspan="5" >&nbsp;</td>
								 </tr>
								 
						  </table>
				  </td>
	  </tr>    


</body>
</html>
